/***************************************************************************
创建者：华磊
 开始时间：               : 2020.1１.09
 copyright            : (C) 深圳市华友高科有限公司
 修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

 修改人:华磊
 修改时间:2020.11.30
 修改内容:对应中间窗口的界面显示的功能对接

 ***************************************************************************
 *   左侧视窗测试用代理类
*                                                                         *
 ***************************************************************************/
#include "leftviewdelegate.h"
#include "hmicommondefine.h"
#include "instructionEnum.h"

//#include <QDebug>

LeftViewDelegate::LeftViewDelegate(LeftView *leftViewIn, QObject* parent):QObject(parent)
{
    leftView = leftViewIn;
    initConnect();
}

LeftViewDelegate::~LeftViewDelegate()
{
}

void LeftViewDelegate::initConnect()
{
    connect(leftView,SIGNAL(toRunView()),this,SLOT(toRunViewSlot()));              //运行
    connect(leftView,SIGNAL(toJogView()),this,SLOT(toJogViewSlot()));              //关节
    connect(leftView,SIGNAL(toProgramView()),this,SLOT(toProgramViewSlot()));      //程序
    connect(leftView,SIGNAL(toIoStatusView()),this,SLOT(toIoStatusViewSlot()));    //IO
    connect(leftView,SIGNAL(toMessageView()),this,SLOT(toMessageViewSlot()));    //信息
    connect(leftView,SIGNAL(showCraftToolView_signal()),this,SLOT(showCraftToolView_slot()));
}

void LeftViewDelegate::toRunViewSlot()
{
    //qDebug()<<"runviewok";
    //进入槽后,假设: id = RUN_VIEW 枚举 设置
    //另一边,有一个定时器,若 == RUN_VIEW,if isHidden ->show ,其他hide
    //emit UpdateView

    emit changeViewIDsignal(MID_VIEW_RUN);
}

void LeftViewDelegate::showCraftToolView_slot()
{
    emit changeViewIDsignal(MID_VIEW_CRAFT_TOOL);
}

void LeftViewDelegate::toJogViewSlot()
{
    //qDebug()<<"jogviewok";
    emit changeViewIDsignal(MID_VIEW_JOG);
}

void LeftViewDelegate::toProgramViewSlot()
{
    //qDebug()<<"programviewok";
    emit changeViewIDsignal(MID_VIEW_PROGRAM);
}

void LeftViewDelegate::toIoStatusViewSlot()
{
    //qDebug()<<"satusview";
    emit changeViewIDsignal(MID_VIEW_IO);
}

void LeftViewDelegate::toMessageViewSlot()
{
    //qDebug()<<"messageok";
    emit changeViewIDsignal(MID_VIEW_MESSAGE);
}
